<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="/fuman/js/order.js"></script>
<script>
function addorder()
{
	$('#addstorageform').modal('show');	
}
function showExpressForm(type){
	//var str = selectallpro();
    var submit_act = new Array();
    submit_act['UPS'] = "/expressshipment/ajaxbutton?op=saveexpress", 
	submit_act['DHL'] = "/expressshipment/ajaxbutton?op=DHLexpress",
	submit_act['UBI'] = "/expressshipment/ajaxbutton?op=UBIexpress",
	submit_act['CNE'] = "/expressshipment/ajaxbutton?op=CNEexpress",
	submit_act['YIDA'] = "/expressshipment/ajaxbutton?op=YIDAexpress";
	submit_act['JIAC'] = "/expressshipment/ajaxbutton?op=JIACexpress";
	submit_act['ZTO'] = "/expressshipment/ajaxbutton?op=ZTOexpress";
    $("#expressOrderForm").attr("action", submit_act[type]);
	$("#type").val(type);
	if(type=='UBI')
	{
		$("#showmabang").show();	
	}
	if(type=='CNE'){
		$("#cnetype_tr").show();
	}else{
		$("#cnetype_tr").hide();
	}
	if(type=="JIAC"){
		$("#jiactype_tr").show();
	}else{
		$("#jiactype_tr").hide();
	}
    $('#expressform').modal('show');
}

function moreopenMailNoUrl1(t,orderType)	//orderType 1、顺丰 2、UPS
{
	var str = selectallpro();
	if(str !=false)
	{
			$("#print_btn").attr("href","/expressshipment/ajaxbutton?op=printlabel&orderType="+orderType+"&id="+str);
			return true;
			//openinvoiceUrl1(str,orderType);//打印标签

	}
}
function delShipment(id,t){
	if(confirm("确定移除?"))
	{
		$.post("/expressshipment/ajaxbutton", {"op": "delShipment","id":id,"st":t},
		  function(data){
				if(data.txt==200){
					//document.location.href = data.url;
					//alert('删除成功');
					location.reload();
					return;
				}

				if(data.txt==201)
				{
					alert(data.text);
					return ;
				}
				
			return;
		   },"json");
	}
}

function setOrderState(){
	var str = selectallpro();
	if(str !=false){
		if(confirm("确定设置选中订单为配货中状态吗？")){
		 $.post("/deliverorder/ajaxbutton", {"op": "dodistribution","str":str},
				function(data){
					//alert(data);return false;
					if(data==200)
					{
						location.reload();
					}
				},"json");

		   }
	}else{
		//alert('请先选择要设置成配货中的订单');
	}
}
function setWrongFlag(id){
	$.post("/Expressshipment/ajaxbutton", {"op": "setWrongFlag", "id": id},function (data) {
			if (data.result == 200) {
				if(data.have_wrong==0){
					$("#wrongimg_"+id).attr("src","/fuman/images/icons/g_cross_circle.png");
					$("#wrongimg_"+id).attr("title","可发货");
				}else{
					$("#wrongimg_"+id).attr("src","/fuman/images/icons/cross_circle.png");
					$("#wrongimg_"+id).attr("title","禁止打印");
				}
			}else {
				//alert("提交成功");
				//$('#DisabledOrderDiv').modal('hide');
			}
		},"json");
}
function outexpressexcel(exptype){
var url = "/expressshipment/ajaxbutton?op=outexpressexcel&types="+exptype;
	var winWidth = window.screen.width;
    var winHeight = window.screen.height;
    var newWidth = 1000;
    var newHeight = 750;
    window.open(url, '_blank', 'height=' + newHeight + ',width=' + newWidth + ',top=10,left=' + (winWidth - newWidth) / 2 + ',toolbar=no,menubar=no,scrollbars=yes,resizable=no,loocation=no,status=no');
}
</script>
<title>交运列表</title>
<body class="withvernav">
<div class="bodywrapper"> {{include file='/public/leftmenu.tpl'}}
  <div class="centercontent">
    <div class="pageheader notab">
      <h1 class="pagetitle">{{$expressType}}交运列表</h1>
      <span class="pagedesc"></span>
       <div class="menulist">
        <ul class="profile_summary">
        {{if $orderType==1}}
          <li> <a href="javascript:void(0)" onClick="addorder()" class=""><span>顺丰交运</span></a></li>
          <li><a href="/doit/sfexpress/0/0"  target="_blank"><span>批量交运顺丰</span></a></li>
       {{else}}
       		{{if $isdhlremote==1}}
             <li> <a href="http://47.88.102.159/shipmentOrder.php" target="_blank"><span>{{$expressType}}远程交运</span></a></li>
          	 <li><a href="/expressshipment/ajaxbutton?op=GetOverDHLexpress"  target="_blank"><span>{{$expressType}}获取运单</span></a></li>
            {{else}}
        
       
            <li> <a href="javascript:showExpressForm('{{if $expressType=='日本邮政'}}YIDA{{else}}{{$action_url}}{{/if}}');" class=""><span>{{$expressType}}交运</span></a></li>
          	<li><a href="/expressshipment/ajaxbutton?op={{if $expressType=='日本邮政'}}YIDA{{else}}{{$action_url}}{{/if}}express"  target="_blank"><span>{{$expressType}}批量交运</span></a></li>
            
            {{/if}}
       {{/if}}
        </ul>
      </div>
    </div>
    <!--pageheader-->
    
    <div id="contentwrapper" class="contentwrapper">
      <div id="basicform" class="subcontent">
          <!--搜索栏-->
          <div style="float:left">  &nbsp;&nbsp; <a href="javascript:void(0)" onClick="repeatexpress({{$orderType}})" class="btn btn2 btn_help"><span>重新交运</span></a> 
          &nbsp;&nbsp;&nbsp;{{if $userid==133 || $userid==295 || $userid==365 || $userid==345}}
          	{{if $orderType==3}}<button class="stdbtn btn_red" onClick="outexpressexcel('DHL')">导出今日发货列表</button>{{/if}}
          {{/if}}
          </div>
           <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
    <form class="stdform stdform2" method="get" action="/expressshipment/datalist">
    <input type="hidden" name="orderType" id="orderType" value="{{$orderType}}" >
      <div class="tableoptions"> 交运时间：
       <input type="text"  name="starttime" value="{{$starttime}} " onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker" /> - <input type="text"  name="endtime" value="{{$endtime}} " onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker" />
       关键词: <input type="text" name="other" id="other" style="width:150px;" value="{{$other}}" placeholder="订单号或运单号" />
       &nbsp;
      订单状态:
                           <select name="statusst" class="selection" style="width:100px;">
                            <option value=""  selected>请选择</option>
                                <option value="1" {{if $statusst==1}} selected{{/if}}>已支付</option>
                                <option value="2" {{if $statusst==2}} selected{{/if}}>配货中</option>
                                <option value="3" {{if $statusst==3}} selected{{/if}}>已发货</option>
                            </select>
                           
&nbsp;<select name="isexe" class="selection" style="width:100px;">
                            <option value=""  selected>交运状态</option>
                                <option value="1" {{if $isexe==1}} selected{{/if}}>交运成功</option>
                                <option value="2" {{if $isexe==2}} selected{{/if}}>交运失败</option>
                                <option value="3" {{if $isexe==3}} selected{{/if}}>未交运</option>
                            </select>
        <button class="btn btn_orange btn_search radius50">Search</button>
         &nbsp; 
        &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; 
        <a href="javascript:void(0)" id="print_btn" onClick="moreopenMailNoUrl1(1,{{$orderType}})" class="btn btn2 btn_help" target="_blank"><span>打印标签</span></a>
        &nbsp;&nbsp;
        {{if $orderType==1}}
        <a href="javascript:void(0)" onClick="moreopenMailNoUrl1(2,{{$orderType}})" class="btn btn2 btn_help"><span>打印发票</span></a>
        &nbsp;&nbsp;
        {{/if}}
        
        <a href="javascript:void(0)" onClick="setOrderState()" class="btn btn2 btn_help"><span>标配货</span></a>
         
      </div>
    </form>
    <!--搜索栏结束-->

             <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
          
            <thead>
              <tr>
               <th class="head0"><input name="allchk" id="allchk" type="checkbox" onClick="allSelect('ppid[]')"></th>
                <th class="head1">订单号</th>
                <th class="head1">状态</th>
                <th class="head1">客户名称</th>
                <th class="head1">来源平台</th>
                <th class="head1">国家</th>
                <th class="head1">操作人</th>
                <th class="head1">状态</th>
                <th class="head1">运单号</th>
                 <th class="head1">交运时间</th>
                 <th class="head1">发货方式</th>
                 <th class="head1">操作</th>
              </tr>
            </thead>
          
             {{foreach from=$orderlist item=detail key=key}}
                <tr>
                 <td><input name="ppid[]" type="checkbox" value="{{$detail.id}}"></td>

                <td>{{if $detail.haveWrong==0}}
      <img title="可发货" src="/fuman/images/icons/g_cross_circle.png" alt="" id="wrongimg_{{$detail.id}}" onClick="setWrongFlag({{$detail.id}})" width="16" height="16">
      {{/if}}
      {{if $detail.haveWrong==1}}
      <img title="禁止打印" src="/fuman/images/icons/cross_circle.png" alt="" id="wrongimg_{{$detail.id}}" onClick="setWrongFlag({{$detail.id}})" width="16" height="16">
     {{/if}} <a href="{{if $detail.isform==1}}http://192.168.1.100:89/eshop/order.do?method=edit&orderid={{$detail.orderID}}{{else}}/orderlist/orderlist?kw={{$detail.orderID}}{{/if}}" target="_blank">{{$detail.orderID}}</a></td>
                <td>{{$detail.statusst}}</td>
                <td title="{{$detail.customerid}}">{{$detail.customerid|getstr:18:0}}</td>
                <td>{{$detail.customertype}}</td>
                <td>{{$detail.customerqq}}</td>
                <td>{{$detail.createUser}}</td>
                <td>{{if $detail.isexe==1}}交运完成{{/if}}
                {{if $detail.isexe==2}}<font color="red">交运失败</font>{{/if}}{{if $detail.isexe==0}}未交运{{/if}}</td>
                <td>{{if $detail.isexe==1}}{{$detail.mailNo}}{{if $detail.orderType==14 and $detail.exememo!='交运成功'}}<font color="red">,{{$detail.exememo}}</font>{{/if}}{{/if}}{{if $detail.isexe==2}}<span title="{{$detail.exememo}}">{{$detail.exememo|substr:0:18}}..</span>{{/if}}</td>
                <td>{{$detail.mailinstime|substr:5:14}}</td>

                <td>{{$detail.deliver}}</td>
                <td> {{if $detail.isexe==0 || $detail.isexe==2}}<a href="javascript:void(0)" onClick="delShipment({{$detail.id}},'delShipment')" >删除</a>{{/if}}
                 <!--"/expressshipment/ajaxbutton?op=printlabel&orderType={{$detail.orderType}}&id={{$detail.id}}"-->
                 {{if $detail.isexe==1}}
                <a href="/expressshipment/ajaxbutton?op=printlabel&orderType={{$detail.orderType}}&id={{$detail.id}}" target="_blank">标签</a> 
                {{if $orderType neq 4}}<a href="{{$detail.printUrl}}" target="_blank">pdf</a>{{/if}}{{/if}} <a href="javascript:void(0)" style="display:none" onClick="delShipment({{$detail.id}},'delShipment')" >删除</a></td>
                </tr>
              {{/foreach}}
          </table>
          
        <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
         </div></div>
<div style="border-top:1px solid #ddd;margin:0px 10px;display:none">

<div align="center">&copy;2016-2017 上海复漫网络科技有限公司&amp;上海漫创商贸有限公司 版权所有<br>
&nbsp;</div>
</div>
<!--CNE,UBI,DHL交运表单-->
<form action="/expressshipment/DHLexpress"  method="post" name="expressOrderForm" id="expressOrderForm" target="_blank">
<input type="hidden" name="type" id="type">
<input type="hidden" name="course" value="express_send">
  <div class="modal fade" id="expressform" tabindex="-1" role="dialog" aria-labelledby="expressform" aria-hidden="true">
    <div class="modal-dialog" style="width:740px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="sprintform"> 待交运订单编号  </h4>
        </div>
        <div class="modal-body">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="100">订单号： </td>
              <td align="left"><textarea name="orderlist" id="orderlistst" cols="10" rows="10"></textarea></td>
            </tr>
            <tr style="display:none" id="cnetype_tr">
                <td>发货方式</td>
                <td><select name="cnetype" id="cnetype">
                <option value="RM平邮直航(GBP)">RM平邮直航(GBP)</option>
                <option value="CNE全球特惠">CNE全球特惠</option>
                <option value="CNE全球通平邮">CNE全球通平邮</option>
                <option value="全球特惠(EUR)">全球特惠(EUR)</option>
                <option value="CNE全球通挂号">CNE全球通挂号</option>
                <option value="CNE全球专项">CNE全球专项</option></select>
                </td>
            </tr>
            <tr style="display:none" id="jiactype_tr">
            <td>发货方式</td>
            <td>
            <select name="jiactype" id="jiactype">
                <option value="德国佳成物流">德国佳成物流</option>
                <option value="法国佳成物流">法国佳成物流</option>
                <option value="英国佳成物流">英国佳成物流</option>
                <option value="澳洲佳成物流">澳洲佳成物流</option>
                <option value="西班牙佳成物流">西班牙佳成物流</option>
            </select>
            </td>
            </tr>
             <tr id="showmabang" style="display:none">
              <td>交运马帮订单： </td>
              <td align="left" style="color:#999"><input name="isformMabang" type="checkbox" value="1"> 上面填写订单号为马帮订单号时，这里打勾</td>
            </tr>
             <tr>
              <td>注意： </td>
              <td align="left" style="color:#999">一行一个订单号</td>
            </tr>
          </table>
          <div class="modal-footer">
            <button type="submit" class="btn btn-primary"> 提交 </button>
            <button type="button" class="btn btn-default" 
               data-dismiss="modal" style="display:none"> 关闭 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
</form>
<div id="goToTop" style="display:none"><a href="javascript:;">TOP</a></div>
</body>
</html>